﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common
{
    public class Instrument
    {
        public Instrument()
        {
            PriceSeriesList = new List<PriceSeries>();
        }
        [Key]
        public int Id { get; set; }
        public int InstrumentTypeId { get; set; }
        [Required]
        [MaxLength(200)] 
        public string Name { get; set; }
        public bool Active { get; set; }
        public bool Special { get; set; }
        public int Addme { get; set; }

        public virtual  ICollection<PriceSeries> PriceSeriesList { get; private set; }

    }

    public class PriceSeries
    {
        public PriceSeries()
        {
            PriceList = new List<Price>();
            DividendList = new List<Dividend>();
        }
        [Key]
        public int Id { get; set; }
        public int InstrumentId { get; set; }
        public string Name { get; set; }
        public int TrackRecordType { get; set; }
        public bool IsMaster { get; set; }
        public string IdentifierA { get; set; }
        public string OtherIdentifier { get; set; }
        public virtual  ICollection<Price> PriceList { get; private set; }
        public virtual  ICollection<Dividend> DividendList { get; private set; }
        public Statictics Statistic { get; set; }

        public virtual Instrument Instrument { get; set; }

    }

    public class Price
    {
        [Key]
        public int PriceId { get; set; }
        public int PriceSeriesId { get; set; }
        public string Currency { get; set; }
        public double Ror { get; set; }
        public double Nav { get; set; }
        public int PriceQuality { get; set; }
        public DateTime ValueAsOf { get; set; }

    }

    public class Dividend
    {
        [Key]
        public int DividendId { get; set; }
        public int PriceSeriesId { get; set; }
        public string Currency { get; set; }
        public double Ror { get; set; }
        public DateTime ValueAsOf { get; set; }

    }

    public class Statictics
    {
        [Key]
        public int StatisticsId { get; set; }
        public int PriceSeriesId { get; set; }
        public double Proportions { get; set; }
        public int Count { get; set; }
        public double Average { get; set; }
        public double Sum { get; set; }
    }
}
